home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Caml Light 0.61 / Source / src / runtime / stacks.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-24  |  1.1 KB  |  69 lines  |  [TEXT/MPS ]

  1. /* structure of the stacks */
  2.  
  3. #ifndef _stacks_
  4. #define _stacks_
  5.  
  6.  
  7. #include "mlvalues.h"
  8. #include "memory.h"
  9.  
  10. /* 1- Argument stack : (value | mark)*  */
  11.  
  12. #define MARK ((value) 0)
  13.  
  14. /* 2- Return stack (return addresses and environment cache)
  15.       A sequence of :
  16.  
  17.    High addresses            OR
  18.  
  19.     N values                N values
  20.     return_frame with cache_size = N    trap_frame with cache_size=N+2
  21.         ...
  22.    Low addresses
  23. */
  24.  
  25. struct return_frame {
  26.   code_t pc;
  27.   value env;
  28.   int cache_size;
  29. /*value cache[cache_size]; */
  30. };
  31.  
  32. struct trap_frame {
  33.   code_t pc;
  34.   value env;
  35.   int cache_size;
  36.   value * asp;
  37.   struct trap_frame * tp;
  38. /*value cache[cache_size]; */
  39. };
  40.  
  41. extern value * arg_stack_low;
  42. extern value * arg_stack_high;
  43. extern value * arg_stack_threshold;
  44. extern value * ret_stack_low;
  45. extern value * ret_stack_high;
  46. extern value * ret_stack_threshold;
  47. extern value * extern_asp;
  48. extern value * extern_rsp;
  49. extern struct trap_frame * tp;
  50. extern value global_data;
  51.  
  52. #ifdef ANSI
  53.  
  54. void reset_roots(void);
  55. void init_stacks(void);
  56. void realloc_stacks(void);
  57.  
  58. #else
  59.  
  60. void reset_roots();
  61. void init_stacks();
  62. void realloc_stacks();
  63.  
  64. #endif
  65.  
  66.  
  67. #endif /* _stacks_ */
  68.  
  69.